package com.lee.security.handler;

import org.springframework.stereotype.Component;

/**
 * @author lee
 * @date 2019年1月23日
 */
@Component
public class TokenDestroy {

	/*@Autowired
	private UserRepository userRepository;

	@Autowired
	private ClientDetailsService clientDetailsService;

	@Autowired
	private TokenStore tokenStore;

	public void tokenDestroy(Long userId, String clientId) {

		ClientDetails clientDetails = null;

		clientDetails = clientDetailsService.loadClientByClientId(clientId);

		User user = userRepository.findById(userId).orElseThrow(() -> new UsernameNotFoundException("用户不存在"));

		TokenRequest tokenRequest = new TokenRequest(Maps.newHashMap(), clientId, clientDetails.getScope(), "custom");

		OAuth2Request oAuth2Request = tokenRequest.createOAuth2Request(clientDetails);

		Authentication authentication = new UsernamePasswordAuthenticationToken(user, user.getPassword());

		OAuth2Authentication oauth2Authentication = new OAuth2Authentication(oAuth2Request, authentication);

		OAuth2AccessToken existingAccessToken = tokenStore.getAccessToken(oauth2Authentication);

		if (existingAccessToken != null) {
			tokenStore.removeAccessToken(existingAccessToken);
		}

	}*/

}
